﻿<navigation:Page x:Class="SampleBrowser.Views.SampleFullTextSearchHighlight" 
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
           xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
           xmlns:doc="http://schemas.firstfloorsoftware.com/documenttoolkit"
           xmlns:sample="http://schemas.firstfloorsoftware.com/documenttoolkit/samplebrowser"
           mc:Ignorable="d"
           xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
           d:DesignWidth="640" d:DesignHeight="480"
           Title="Full Text Search Highlighting">
    <Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <TextBlock x:Name="HeaderText" Grid.ColumnSpan="2" Style="{StaticResource HeaderTextStyle}" Text="Full Text Search Highlighting"/>

        <doc:DocumentDataSource x:Name="DataSource" LoadError="DataSource_LoadError" SearchCompleted="DataSource_SearchCompleted"/>

        <doc:DocumentViewer x:Name="Viewer" Grid.Row="1" DocumentDataSource="{Binding ElementName=DataSource}" />
        
        <StackPanel Grid.Row="2" Orientation="Horizontal" Margin="0,8,0,0" HorizontalAlignment="Center">
            <doc:PageNavigator x:Name="Navigator"
                               PageCount="{Binding PageCount, ElementName=Viewer}"
                               PageIndex="{Binding PageIndex, ElementName=Viewer, Mode=TwoWay}"
                               Margin="4,0,0,0" />

            <Button Margin="4,0,0,0" Padding="7">
                <Button.Command>
                    <sample:OpenPdfOrXpsFromDiskCommand DocumentDataSource="{Binding ElementName=DataSource}" />
                </Button.Command>
                <Button.Content>
                    <Image Source="/SampleBrowser;component/Assets/Icons/open.png" />
                </Button.Content>
            </Button>

            <TextBox x:Name="SearchText" Width="150" Margin="4,0,0,0" />
            <Button Content="Search" Margin="4,0,0,0" Command="{Binding SearchCommand, ElementName=DataSource}" >
                <Button.CommandParameter>
                    <doc:SearchQuery TextToSearch="{Binding Text, ElementName=SearchText}" />
                </Button.CommandParameter>
            </Button>
            <Button Content="Cancel search" Margin="4,0,0,0" Command="{Binding CancelSearchCommand, ElementName=DataSource}" />
        </StackPanel>
    </Grid>
</navigation:Page>
